package com.pat.common.util;

import java.util.HashMap;

import com.cloopen.rest.sdk.CCPRestSDK;


public class SmsUtil {

	private static final String VERIFY_TEMPLATE_ID = "170565";
	
	private static final String ACCOUNT_SID = "8aaf07085b5fee9a015b8af0ec1f12dd";
	
	private static final String AUTH_TOKEN = "dd9c8fb8a0984ba1a3965241eb95e049";

	private static final String APP_ID = "8a216da85b602cda015b8b6ad24c1349";
	
	private static class  YTXHandler{
		private YTXHandler(){}
		private final static CCPRestSDK restAPI ;
		static{
		    restAPI = new CCPRestSDK();
			restAPI.init("app.cloopen.com", "8883");
			restAPI.setAccount(ACCOUNT_SID, AUTH_TOKEN);
			restAPI.setAppId(APP_ID);
		}
		public static CCPRestSDK getInstance(){
			return restAPI ;
		}
	}
	
	public static void sendVerifyCode(String phone,String code,String expireTime){
		if (phone!=null&&!"".equals(phone)) {
			HashMap<String, Object> result = YTXHandler.getInstance().sendTemplateSMS(phone, VERIFY_TEMPLATE_ID, new String[]{
					code,expireTime
			});
			System.out.println(result);
		} 
	}
	
	
}
